package com.yc.navy.goods.service.lmpl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yc.navy.goods.bean.ShopInfo;
import com.yc.navy.goods.bean.UpdateStatusInfo;
import com.yc.navy.goods.dto.ShopInfoDTO;
import com.yc.navy.goods.dto.ShopInfoDTOO;
import com.yc.navy.goods.enums.ResultEnum;
import com.yc.navy.goods.mapper.IShopInfoMapper;
import com.yc.navy.goods.service.IShopInfoService;
import com.yc.navy.goods.util.FindByPageParamUtil;
import com.yc.navy.goods.util.StringUtil;
import com.yc.navy.goods.vo.StreamVO;

@Service
public class ShopInfoServiceImpl implements IShopInfoService{
	@Autowired
	private IShopInfoMapper shopInfoMapper;

	@Override
	public List<ShopInfoDTO> findsid() {
		return shopInfoMapper.findsid();
	}

	@Override
	public Integer joinshop(ShopInfo shop) {
		return shopInfoMapper.joinshop(shop);
	}

	@Override
	public ShopInfoDTO check(Integer mid) {
		return shopInfoMapper.check(mid);
	}

	@Override
	public Integer createshop(ShopInfo shop) {
		return shopInfoMapper.createshop(shop);
	}

	@Override
	public StreamVO findList(Map<String,Object> map) {
		List<ShopInfo> list = shopInfoMapper.findList(FindByPageParamUtil.StreamVOfindByPageParam(map));
		if(list.isEmpty() || list.size() <= 0 ) {
			return new StreamVO(ResultEnum.ERROR);
		}
		return new StreamVO(list,shopInfoMapper.total());
	}

	@Override
	public List<ShopInfo> brandList() {
		return shopInfoMapper.brandList();
	}

	@Override
	public ShopInfo shopOne(Integer sid) {
		return shopInfoMapper.shopOne(sid);
	}

	@Override
	public ShopInfoDTOO ShopOne(Integer sid) {
		return shopInfoMapper.ShopOne(sid);
	}

	@Override
	public Integer updatestatus(UpdateStatusInfo update) {
		if(StringUtil.checkNull(String.valueOf(update.getSid()),String.valueOf(update.getStatus()))) {
			return -1;
		}
		return shopInfoMapper.updatestatus(update);
	}


	
}
